<?php
include "../config.php";
include "../library.php";

$parsing= $_GET['parsing'];

$sql = mysql_query("SELECT * FROM koleksi WHERE idkoleksi='$parsing'");
$v = mysql_fetch_array($sql);

$sql2 = mysql_query("SELECT * FROM kategori WHERE idkategori='$v[idkategori]'");
$v2 = mysql_fetch_array($sql2);

$sql3 = mysql_query("SELECT * FROM ruangan WHERE idruangan='$v[idruangan]'");
$v3 = mysql_fetch_array($sql3);

$json = '{"koleksi":[ ';

$json .= '{ ';
	$json .= '"id":"'.$v['idkoleksi'].'",
	"kategori":"'.$v2['namakategori'].'",
	"nama":"'.$v['namakoleksi'].'",
	"lokasi":"'.$v['lokasitemu'].'",
	"tgl":"'.$v['tgltemu'].'",
	"penemu":"'.$v['penemu'].'",
	"umur":"'.$v['umur'].'",
	"ukuran":"'.$v['ukuran'].'",
	"deskripsi":"'.$v['deskripsi'].'",
	"url":"'.$v['url'].'",
	"gambar":"'.$v['gambar'].'",
	"data_added":"'.$v['data_added'].'",
	"ruangan":"'.$v3['namaruangan'].'"
	},';

$json = substr($json,0,strlen($json)-1);
$json .= ']}';

echo $json;
?>